package com.huluobo.a2307douyindemo.shop

import androidx.recyclerview.widget.LinearLayoutManager
import com.huluobo.a2307douyindemo.adapter.CommentAdapter
import com.huluobo.a2307douyindemo.databinding.FragmentCommentBinding
import com.huluobo.lib_base.mvvm.BaseFragment


class CommentFragment : BaseFragment<FragmentCommentBinding, ShopViewModel>() {
    private lateinit var commentAdapter: DetailCommentAdapter

    override fun initData() {
        vm.getComment()
        vm.getCommentSuccess.observe(this) {
            commentAdapter.data.clear()
            commentAdapter.data.addAll(it)
            commentAdapter.notifyDataSetChanged()
        }
    }

    override fun initView() {
        binding.commentRv.layoutManager = LinearLayoutManager(requireContext())
        commentAdapter = DetailCommentAdapter()
        binding.commentRv.adapter = commentAdapter
    }
}